/* eslint-disable camelcase */
/* eslint-disable import/extensions */
import React from 'react';
import ReactDOM from 'react-dom';

import { ConfigProvider } from 'antd';
import zh_CN from 'antd/lib/locale-provider/zh_CN';
import { Provider } from 'react-redux';
import { ConnectedRouter } from 'connected-react-router';
import {store, persistor} from '@/store/index';
import history from '@/store/history';

import Tabs from '@/components/tabs';
import { Switch, Route, Redirect } from 'react-router-dom';
import Home from '@/routes/home';
import Mine from '@/routes/mine';
import Profile from '@/routes/profile';
import Register from '@/routes/register';
import Login from '@/routes/login';
import Details from '@/routes/details';
import Cart from "@/routes/Cart";
import { PersistGate } from "redux-persist/integration/react";
import './styles/index.scss';

ReactDOM.render(
  <Provider store={store}>
    <PersistGate loading={null} persistor={persistor}>
      <ConnectedRouter history={history}>
        <ConfigProvider locale={zh_CN}>
          <main className="main-container">
            <Switch>
              <Route path="/" exact component={Home} />
              <Route path="/mine" exact component={Mine} />
              <Route path="/profile" exact component={Profile} />
              <Route path="/register" exact component={Register} />
              <Route path="/login" exact component={Login} />
              <Route path="/details" exact component={Details} />
              <Route path="/cart" component={Cart} />
              <Redirect to="/" />
            </Switch>
          </main>
          <Tabs />
        </ConfigProvider>
      </ConnectedRouter>
  
    </PersistGate>
   </Provider>,
  document.getElementById('root'),
);
